package com.weaver.qfengx.api.ding;

import com.alibaba.fastjson.JSONArray;

public class DingApiHttpClientResult {

    private int errcode;
    private String errmsg;
    private String access_token;
    private int expires_in;
    private int httpcode;
    private String request_id;
    private String task_id;

    @Override
    public String toString() {
        return "DingApiHttpClientResult{" +
                "errcode=" + errcode +
                ", errmsg='" + errmsg + '\'' +
                ", access_token='" + access_token + '\'' +
                ", expires_in=" + expires_in +
                ", httpcode=" + httpcode +
                ", request_id='" + request_id + '\'' +
                ", task_id='" + task_id + '\'' +
                ", item_count=" + item_count +
                ", jsonArray=" + jsonArray +
                '}';
    }

    public String getTask_id() {
        return task_id;
    }

    public DingApiHttpClientResult setTask_id(String task_id) {
        this.task_id = task_id;
        return this;
    }

    private int item_count;
    private JSONArray jsonArray;

    public int getItem_count() {
        return item_count;
    }

    public DingApiHttpClientResult setItem_count(int item_count) {
        this.item_count = item_count;
        return this;
    }

    public JSONArray getJsonArray() {
        return jsonArray;
    }

    public DingApiHttpClientResult setJsonArray(JSONArray jsonArray) {
        this.jsonArray = jsonArray;
        return this;
    }

    public String getRequest_id() {
        return request_id;
    }

    public DingApiHttpClientResult setRequest_id(String request_id) {
        this.request_id = request_id;
        return this;
    }

    public int getHttpcode() {
        return httpcode;
    }

    public DingApiHttpClientResult setHttpcode(int httpcode) {
        this.httpcode = httpcode;
        return this;
    }

    public static DingApiHttpClientResult createResult(int errcode, String errmsg) {
        return new DingApiHttpClientResult().setErrcode(errcode).setErrmsg(errmsg);
    }

    public boolean isOk() {
        return this.httpcode == 200 && errcode == 0;
    }

    public int getErrcode() {
        return errcode;
    }

    public DingApiHttpClientResult setErrcode(int errcode) {
        this.errcode = errcode;
        return this;
    }

    public String getErrmsg() {
        return errmsg;
    }

    public DingApiHttpClientResult setErrmsg(String errmsg) {
        this.errmsg = errmsg;
        return this;
    }

    public String getAccess_token() {
        return access_token;
    }

    public DingApiHttpClientResult setAccess_token(String access_token) {
        this.access_token = access_token;
        return this;
    }

    public int getExpires_in() {
        return expires_in;
    }

    public DingApiHttpClientResult setExpires_in(int expires_in) {
        this.expires_in = expires_in;
        return this;
    }

}
